#ifndef CODEGEN_VISITOR_H
#define CODEGEN_VISITOR_H

#include <stdio.h>
#include <stdlib.h>
#include "base.h"
#include "syntaxTree.h"
#include "symbolTable.h"

#define TAB             "    "
#define PRINT_TYPE(t)   if (t == VOID) printf("void"); \
                        else printf("i%d", _get_type_size(t))

#define PRINT_VALUE(n, i)   if (n->kind == IDENTIFICADOR ) \
                            printf("%%%s", n->name); \
                            else { \
                            if (i == -1) printf("%d", ast_node_get_value_as_int(n)); \
                            else printf("%%%d", i); \
                            }


Visitor *codegen_newVisitor();

void codegen_visit_program (Visitor *, TreeNode *node);
void codegen_visit_programdecl (Visitor *visitor, TreeNode *node);
void codegen_visit_procfunc_list (Visitor *visitor, TreeNode *node);
void codegen_visit_procfunc (Visitor *visitor, TreeNode *node);
void codegen_visit_vardecl_list (Visitor *visitor, TreeNode *node);
void codegen_visit_vardecl (Visitor *visitor, TreeNode *node);
void codegen_visit_identifier_list (Visitor *visitor, TreeNode *node);
/*void codegen_visit_param_list (Visitor *visitor, ThreeNode *node);
void codegen_visit_parameter (Visitor *visitor, ThreeNode *node);
void codegen_visit_statement_list(Visitor *visitor, ThreeNode *node);
void codegen_visit_printint_stmt (Visitor *visitor, ThreeNode *node);
void codegen_visit_printchar_stmt (Visitor *visitor, ThreeNode *node);
void codegen_visit_printbool_stmt (Visitor *visitor, ThreeNode *node);
void codegen_visit_printline_stmt (Visitor *visitor, ThreeNode *node);
void codegen_visit_assignment_stmt (Visitor *visitor, ThreeNode *node);
void codegen_visit_if_stmt (Visitor *visitor, ThreeNode *node);
void codegen_visit_while_stmt (Visitor *visitor, ThreeNode *node);
void codegen_visit_for_stmt (Visitor *visitor, ThreeNode *node);*/
/*void codegen_visit_binary_expr (Visitor *visitor, TreeNode *node);
void codegen_visit_notfactor (Visitor *visitor, TreeNode *node);
void codegen_visit_call (Visitor *visitor, TreeNode *node);
void codegen_visit_callparam_list (Visitor *visitor, TreeNode *node);
void codegen_visit_callparam (Visitor *visitor, TreeNode *node);
void codegen_visit_identifier (Visitor *visitor, TreeNode *node);
void codegen_visit_literal (Visitor *visitor, TreeNode *node);
void codegen_visit_binary_op (Visitor *visitor, TreeNode *node);
void codegen_visit_not_op (Visitor *visitor, TreeNode *node);*/

void (*visitGenFunctions[])(Visitor *visitor, TreeNode *node) = {
	codegen_visit_program,
	codegen_visit_programdecl
	//codegen_visit_procfunc_list,
	//codegen_visit_procfunc,
	//codegen_visit_vardecl_list,
	//codegen_visit_vardecl
};
#endif //
